﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="KaiZhang.aspx.cs" Inherits="Web.Pages.YongShui._4.ChaoBiaoKZ.KaiZhang" Theme="Default" %>

<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>开账</title>
     <script src="../../../JS/jquery.js"></script>
    <script type="text/javascript">
        function AjaxData(type) {
            SetControlStatus(false);
            LoadPanel.Show();
            var keywords = "checkerror";
            if (type == 1) {
                keywords = "sumdata";
            }
            ASPxCallback1.PerformCallback(keywords);
        }
        function Check() {
            txtZhuanHuanJG.SetText("");
            LoadPanel.SetText("正在查错...");
            if (DrpQK.GetValue() != "0") {
                HiddenList.Set("glkcheck", DrpQK.GetValue());
            }
            else {
                var lists = $("#glklist").val();
                var arr = lists.split(',');
                HiddenList.Set("glkcheck", lists);
            }
            AjaxData(0);
        }
        function SumData() {
            txtZhuanHuanJG.SetText("");
            LoadPanel.SetText("正在开账...");
            if (DrpQK.GetValue() != "0") {
                HiddenList.Set("glk", DrpQK.GetValue());
            }
            else {
                var lists = $("#glklist").val();
                var arr = lists.split(',');
                HiddenList.Set("glk", lists);
            }
            AjaxData(1);
        }
        function ASPxCallbackCommonComplete(rs) {

            var list = rs.split('|');
            var type = list[0];
            var code = list[1];
            var msg = list[2];
            var next = list[3];
            if (type == "checkerror") {

                if (code > 0) {
                    var allmsg = txtZhuanHuanJG.GetText();
                    txtZhuanHuanJG.SetText(allmsg + "" + msg);

                    HiddenList.Set("glkcheck", next);
                    if (next == "") {
                        SetControlStatus(true);
                        LoadPanel.Hide();
                    }
                    else {
                        AjaxData(0);
                    }

                }
                else {
                    alert(msg);
                }

            }
            else if (type == "sumdata") {
                if (code > 0) {
                    var allmsg = txtZhuanHuanJG.GetText();
                    txtZhuanHuanJG.SetText(allmsg + "" + msg);

                    HiddenList.Set("glk", next);
                    if (next == "") {
                        SetControlStatus(true);
                        LoadPanel.Hide();
                    }
                    else {
                        AjaxData(1);
                    }

                }
                else {
                    alert(msg);
                }
            }
        }
        function SetControlStatus(bool) {
            BtnKZ.SetEnabled(bool);
            BtnSelectError.SetEnabled(bool);
           
            DrpQK.SetEnabled(bool);
        }
        function OpenCWXX() {
            var url = "HuiZongCWXX.aspx";
            openCenter(url, "800px", "500px");
        }

    </script>
     <style type="text/css">
        textarea {
             font-size:16px !important;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
         <dx:ASPxCallback ID="ASPxCallback1" ClientInstanceName="ASPxCallback1" runat="server" OnCallback="ASPxCallback1_Callback" ClientSideEvents-CallbackComplete="function(s,e){ASPxCallbackCommonComplete(e.result);}"></dx:ASPxCallback>
        <dx:ASPxHiddenField ID="HiddenList" ClientInstanceName="HiddenList" runat="server"></dx:ASPxHiddenField>
        <asp:HiddenField ID="glklist" runat="server" />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <div class="tabletitle1">
                    开账
                </div>
                <table style="">
                    <tr>
                        <td>区块：
                        </td>
                        <td>
                            <dx:ASPxComboBox ID="DrpQK" ClientInstanceName="DrpQK" runat="server" ValueType="System.String"></dx:ASPxComboBox>
                        </td>
                        <td>
                            <dx:ASPxLabel ID="IYIM" runat="server" Text=""></dx:ASPxLabel>

                        </td>
                        <td style="min-width: 150px;" align="right">

                            <dx:ASPxLabel ID="LabNum" runat="server" Text=""></dx:ASPxLabel>
                        </td>
                    </tr>
                </table>
                <fieldset style="border: 1px solid  cornflowerblue;">

                    <dx:ASPxMemo ID="txtZhuanHuanJG" runat="server" Height="450px" Width="100%" Visible="false" ReadOnly="true"></dx:ASPxMemo>

                </fieldset>
                <div style="margin-top: 15px; text-align: right">
                    <dx:ASPxLoadingPanel ID="LoadPanel" ClientInstanceName="LoadPanel"  runat="server"  Text="正在查询..."></dx:ASPxLoadingPanel>
                    <dx:ASPxButton ID="BtnSelectError" ClientInstanceName="BtnSelectError" runat="server" Text="查错" UseSubmitBehavior="false" OnClick="BtnSelectError_Click">
                        <ClientSideEvents Click="function(s, e) {  
                    Check();
                }" />
                    </dx:ASPxButton>
                    <dx:ASPxButton ID="BtnKZ" runat="server" ClientInstanceName="BtnKZ" Text="开账" UseSubmitBehavior="false" OnClick="BtnKZ_Click">
                        <ClientSideEvents Click="function(s, e) {  
                    SumData();
                }" />
                    </dx:ASPxButton>

                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </form>
</body>
</html>
